add_library(CmgDudePass MODULE src/CmgDudePass.cpp src/Database.cpp)

# Use C++11 to compile our pass (i.e., supply -std=c++11).
# target_compile_features(CmgDudePass PRIVATE cxx_range_for cxx_auto_type)

# LLVM is (typically) built with no C++ RTTI. We need to match that;
# otherwise, we'll get linker errors about missing RTTI data.
set_target_properties(CmgDudePass PROPERTIES COMPILE_FLAGS "-fno-rtti")

# include mysql_config.def into CmgDudePass outside
# target_compile_options(CmgDudePass BEFORE PRIVATE -include ${CMAKE_HOME_DIRECTORY}/mysql_config.def)

target_include_directories(CmgDudePass PRIVATE include /usr/include/mysql)
target_link_directories(CmgDudePass PRIVATE /usr/lib/x86_64-linux-gnu)
target_link_libraries(CmgDudePass PRIVATE mysqlclient pthread dl z ssl crypto resolv m rt)


# Get proper shared-library behavior (where symbols are not necessarily
# resolved when the shared library is linked) on OS X.
if(APPLE)
    set_target_properties(CmgDudePass PROPERTIES
        LINK_FLAGS "-undefined dynamic_lookup"
    )
endif(APPLE)